package collection;

import javax.swing.text.html.HTMLDocument;
import java.util.*;

public class SubListDemo {
    public static void main(String[] args) {
        List<Integer> C=new ArrayList<>();
        for (int i =0;i<10;i++){
            C.add(i*10);
        }
        System.out.println(C);

        List<Integer>SubList=C.subList(2,8);
        for (int i=0;i< SubList.size();i++){
            SubList.set(i,SubList.get(i)*10);
        }
        System.out.println(SubList);
        System.out.println("C"+C);

        C.set(3,1000);
        System.out.println("C"+C);//将原集合下标为3的元素的数据修改为1000
        System.out.println("SubList"+SubList);//原数据改变 子集数据也跟着改

        C.remove(0);//删除下标为0的元素
        System.out.println("C"+C);
        //System.out.println(SubList);原集合的长度修改之后 子集将不在进行任何操作

    }
}
